package com.shengzai.hbase;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;

import java.io.IOException;

public class PutOne {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        conf.set("hbase.zookeeper.quorum","master,node1,node2");
        Connection connection = ConnectionFactory.createConnection(conf);


        TableName tableName = TableName.valueOf("api_test:api_student");
        Table table = connection.getTable(tableName);

        Put puts = new Put("1810404125".getBytes());
        puts.add("students_info".getBytes(),"age".getBytes(),"18".getBytes());
        puts.add("students_score".getBytes(),"score".getBytes(),"356".getBytes());
        table.put(puts);


        table.close();
        connection.close();
    }
}
